package eu.jpereira.trainings.designpatterns.structural.facade;

import eu.jpereira.trainings.designpatterns.structural.facade.service.BookDBService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.CustomerDBService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.CustomerNotificationService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.OrderingService;
import eu.jpereira.trainings.designpatterns.structural.facade.service.WharehouseService;

public class DefaultBookstoreFacade implements BookstoreFacade {

	private WharehouseService warehouseService;
	private CustomerNotificationService customerNotificationService;
	private CustomerDBService customerService;
	private OrderingService orderingService;
	private BookDBService bookService;
	
	@Override
	public void placeOrder(String customerId, String isbn) {
		customerNotificationService.notifyClient(warehouseService.dispatch(orderingService.createOrder(customerService.findCustomerById(customerId), bookService.findBookByISBN(isbn))));

	}

	public void setCustomerService(CustomerDBService customerService) {
		this.customerService = customerService;
		
	}

	public void setWarehouseService(WharehouseService warehouseService) {
		this.warehouseService = warehouseService;
		
	}

	public void setOrderingService(OrderingService orderingService) {
		this.orderingService = orderingService;
		
	}

	public void setBookService(BookDBService bookService) {
		this.bookService = bookService;
		
	}

	public void setCustomerNotificationService(
			CustomerNotificationService customerNotificationService) {
		this.customerNotificationService = customerNotificationService;
		
	}

}
